//
//  AppDelegate.swift
//  main
//
//  Created by Vencent on 2020/11/12.
//

import UIKit
import ESVNavigator
import ESVHome
import ESVUtil

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    lazy var rootViewController: UIViewController = {
        let homeVC = ESVNavigator.default.viewController(for: .haveNavigation) ?? UIViewController()
        let nav = NavigationController.init(rootViewController: homeVC)
        let tabbarVC: TabBarController = .init()
        tabbarVC.viewControllers = [nav]
        return tabbarVC
    }()

    func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        Config.identifier = Bundle.main.bundleIdentifier ?? ""
        ESVNavigator.APP_SCHEME = "navigator"
        return true
    }
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        ESVHome.initialize()
        
        window = UIWindow.init(frame: UIScreen.main.bounds)
        
        window?.rootViewController = rootViewController
        window?.makeKeyAndVisible()
        return true
    }


}

